package com.mdxq.mall.sale.service.impl;

import com.mdxq.mall.sale.entity.HomeNewProduct;
import com.mdxq.mall.sale.mapper.HomeNewProductMapper;
import com.mdxq.mall.sale.service.HomeNewProductService;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 新鲜好物表 服务层实现。
 *
 * @author ShuJie
 * @since 2025-01-12
 */
@Service
public class HomeNewProductServiceImpl extends ServiceImpl<HomeNewProductMapper, HomeNewProduct>  implements HomeNewProductService{

    @Override
    @Transactional
    public boolean updateRecommendStatus(String ids, Integer recommendStatus) {
        for(String id:ids.split(",")){
            HomeNewProduct product=getById(id);
            product.setRecommendStatus(recommendStatus);
            updateById(product);
        }
        return true;
    }
}
